<template>
  <!-- 人员姓名,部门名称 -->
  <span class="textd" v-if="ifhuanjing == 1">
    <ww-open-data
      v-if="keydata == 1 || this.print.ifaccountyesnoQYWX == 1"
      :type="type"
      :openid="openid"
      class="opendata"
    ></ww-open-data>
    <span class="textd" v-else>
      {{ openid }}
    </span>
  </span>
  <span class="textd" v-else>
    {{ openid }}
  </span>
</template>

<script>
import { fetchwwsign,newagentConfig } from "@/libs/wwsignname";
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      print: (state) => state.print.all,
    }),
  },
  name: "openData",
  props: {
    //类型：分为部门和人员姓名
    type: {
      type: String,
      default: "",
    },
    //id:人员或部门的ID
    openid: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      keydata: localStorage.getItem("ifaccountyesnoQYWX"),
      ifhuanjing: "",
    };
  },
  watch: {},
  created() {
    if (
      this.print.ifaccountyesnoQYWX == 1 ||
      localStorage.getItem("ifaccountyesnoQYWX") == 1
    ) {
      if (
        process.env.NODE_ENV === "development" ||
        process.env.VUE_APP_EVN_CONFIG === "dev"
      ) {
        this.ifhuanjing = 0;
      } else {
        this.ifhuanjing = 1;
      }
    }
  },
  mounted() {
    // if (
    //   this.print.ifaccountyesnoQYWX == 1 ||
    //   localStorage.getItem("ifaccountyesnoQYWX") == 1
    // ) {
    //   let oldPath = localStorage.getItem("oldPath") || "";
    //   let path = this.$route.path;
    //   if (path === oldPath) {
    //   } else {
    //     localStorage.setItem("oldPath", path);
    //     // fetchwwsign();
    //     newagentConfig()
    //   }
    // }
  },
};
</script>

<style lang="less" scoped>
.opendata {
  width: auto !important;
  height: auto !important;
}
.textd{
  // width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>